package com.example.administrator.newfragmentation.fragment.zhihu.third;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.administrator.newfragmentation.R;
import com.example.administrator.newfragmentation.fragment.zhihu.third.child.ShopFragment;
import com.example.administrator.newfragmentation.fragmentMain.BaseZhiHuFragment;

public class ZhiHuThirdFragment extends BaseZhiHuFragment {
    public static ZhiHuThirdFragment newInstance() {
        ZhiHuThirdFragment fragment = new ZhiHuThirdFragment();
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_zhi_hu_first, container, false);
    }

    @Override
    public void onLazyInitView(@Nullable Bundle savedInstanceState) {
        super.onLazyInitView(savedInstanceState);
        if (savedInstanceState == null){
            loadRootFragment(R.id.fl_two_container, ShopFragment.newInstance());
        }else{// 这里可能会出现该Fragment没被初始化时,就被强杀导致的没有load子Fragment
            if(findChildFragment(ShopFragment.class) == null){
                loadRootFragment(R.id.fl_two_container, ShopFragment.newInstance());
            }
        }
    }
}
